-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Provide dict object for to_dict() #16122 #16220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey all, I've implemented this for
Let me know if any of the above should change. |
I haven't looked closely yet, but for the df.to_dict(into=defaultdict) or
I would only support the second.
There should be a 0.20.1 whatsnew. You can add it there since it's backwards-compatible. |
pandas/core/frame.py
Outdated
""" | ||
# GH16122 | ||
if not issubclass(into, collections.Mapping): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do something like
import inspect
if not inspect.isclass(into):
t = type(into)
else:
t = into
if not issubclass(t, collections.Mapping):
raise(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented something like this in core.common
.
pandas/core/series.py
Outdated
if issubclass(into, collections.Mapping): | ||
if into == collections.defaultdict: | ||
return into(None, compat.iteritems(self)) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this and the code in frame into a helper function to avoid duplication
u can put this is core.common
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -18,44 +19,48 @@ def test_to_dict(self): | |||
'A': {'1': 1, '2': 2}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be better as a paramterization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
pandas/tests/series/test_io.py
Outdated
tm.assert_series_equal(Series(self.ts.to_dict(), name='ts'), self.ts) | ||
# GH16122 | ||
test_maps = ( | ||
dict, collections.defaultdict, collections.OrderedDict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
doc/source/whatsnew/v0.20.0.txt
Outdated
- ``DataFrame.style.bar()`` now accepts two more options to further customize the bar chart. Bar alignment is set with ``align='left'|'mid'|'zero'``, the default is "left", which is backward compatible; You can now pass a list of ``color=[color_negative, color_positive]``. (:issue:`14757`) | ||
|
||
- ``Series.to_dict()`` and ``DataFrame.to_dict()`` now support an ``into`` keyword which allows you to specify the ``collections.Mapping`` subclass that you would like returned. The default is ``dict``, which is backwards compatible. (:issue:`16122`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.21.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to doc/source/whatsnew/v0.20.1.txt
Codecov Report
@@ Coverage Diff @@
## master #16220 +/- ##
==========================================
- Coverage 90.86% 90.86% -0.01%
==========================================
Files 162 162
Lines 50887 50895 +8
==========================================
+ Hits 46240 46247 +7
- Misses 4647 4648 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16220 +/- ##
==========================================
- Coverage 90.38% 90.37% -0.02%
==========================================
Files 161 161
Lines 50916 50930 +14
==========================================
+ Hits 46021 46026 +5
- Misses 4895 4904 +9
Continue to review full report at Codecov.
|
693d7dc
to
3070fa3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good. some minor changes.
doc/source/whatsnew/v0.20.0.txt
Outdated
@@ -515,7 +515,6 @@ Other Enhancements | |||
- Options added to allow one to turn on/off using ``bottleneck`` and ``numexpr``, see :ref:`here <basics.accelerate>` (:issue:`16157`) | |||
- ``DataFrame.style.bar()`` now accepts two more options to further customize the bar chart. Bar alignment is set with ``align='left'|'mid'|'zero'``, the default is "left", which is backward compatible; You can now pass a list of ``color=[color_negative, color_positive]``. (:issue:`14757`) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset this file
pandas/core/common.py
Outdated
the desired Mapping. | ||
|
||
""" | ||
if not inspect.isclass(into): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its not a class, then you just look at the class itself, it doesn't matter if its empty. this should return a class only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I wrote it this way is because I imagined someone might pass a pre-populated mapping to this function and expect the series or frame to be appended to what was already in the passed mapping. The error was to make it explicit that this would not happen.
Also happy to simplify this function a little - I'll remove this logic if you don't think its worth checking an empty mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are defining the interface here; this is an internal function, so it should do one thing and ideally have a limited input set. This is just determining if its a valid mapping, no need to get complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would remove this check. This function should just be to ensure that we have an instance that's satisfies the Mapping interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all makes sense - I've reworked the function. It now only returns a class or a partial (if a defaultdict
is passed)
pandas/core/common.py
Outdated
if len(into) > 0: | ||
raise ValueError( | ||
"to_dict() only accepts empty mappings.") | ||
elif type(into) == collections.defaultdict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use isinstance
pandas/core/common.py
Outdated
elif type(into) == collections.defaultdict: | ||
return partial( | ||
collections.defaultdict, into.default_factory) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? what is this trying to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the return partial(...)
part, I'm trying to get around the way defaultdict
accepts arguments. The other out-of-the-box mappings will happily accept only an iterator, which is what both of the to_dict()
functions supply to the return value of this function. defaultdict
also needs a default_factory
, so I use partial
to include the default_factory
so the to_dict()
functions can supply only an iterator.
For the last else
, I'm just sending the class of the supplied mapping (once its been confirmed empty) back to the function to avoid duplicated logic.
If you think a different structure works better, or it should be broken up into multiple functions, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok the defaultdict
handling is fine (use isinstance(type, collections.defaultdict)
though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I see. the problem is you need to accept instances to deal with defaultdict, so you can now be passed an instance of defaultdict OR a class of something else (or even a class of defaultdict which is an error).
hmm. I would right off the bat detect an instance of a default dict, else only allow a mapping ABC (ex-defaultdict). Then I think you are good, no? (IOW else you would raise).
pandas/core/common.py
Outdated
@@ -479,6 +481,43 @@ def _dict_compat(d): | |||
for key, value in iteritems(d)) | |||
|
|||
|
|||
def _standardize_mapping(into): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be leading underscore, this is a private module. do you have a more informative name? (longer is ok).
pandas/core/common.py
Outdated
""" | ||
Helper function to standardize the supplied mapping so it can | ||
be passed to the ``Series.to_dict()`` and ``DataFrame.to_dict()`` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a versionadded
pandas/core/frame.py
Outdated
instance of the mapping type you want. If you want a | ||
collections.defaultdict, you must pass an initialized | ||
instance. | ||
.. versionadded:: 0.21.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line
pandas/core/frame.py
Outdated
Returns | ||
------- | ||
result : dict like {column -> {index -> value}} | ||
result : collections.Mapping like {column -> {index -> value}} | ||
If ``into`` is collections.defaultdict, the return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some examples of using this.
pandas/core/series.py
Outdated
object. Can be the actual class or an empty | ||
instance of the mapping type you want. If you want a | ||
collections.defaultdict, you must pass an initialized | ||
.. versionadded:: 0.21.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more comments. but lgtm.
pandas/core/common.py
Outdated
Parameters | ||
---------- | ||
into : instance or subclass of collections.Mapping | ||
The argument supplied to ``to_dict``. Must be a class, an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove references to to_dict
, this is generic about mappings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, though you can add a See Also
section to point to to_dict
. You can also remove references to to_dict
in the summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the references and added a See Also
section.
pandas/core/common.py
Outdated
@@ -479,6 +481,45 @@ def _dict_compat(d): | |||
for key, value in iteritems(d)) | |||
|
|||
|
|||
def prep_maping_for_to_dict(into): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe standarize_dict_like_mapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even just standardize_mapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to standardize_mapping
pandas/core/common.py
Outdated
elif into == collections.defaultdict: | ||
raise TypeError( | ||
'to_dict() only accepts initialized defaultdicts') | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just return into
here, no need for the else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/common.py
Outdated
elif isinstance(into, collections.defaultdict): | ||
return partial( | ||
collections.defaultdict, into.default_factory) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need the else (just return the partial)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/frame.py
Outdated
>>> df.to_dict(into=OrderedDict) | ||
OrderedDict([('col2', OrderedDict([('a', 0.5), ('b', 0.75)])), | ||
('col1', OrderedDict([('a', 1), ('b', 2)]))]) | ||
>>> dd = defaultdict(list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice examples!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a blank line and a preamble to this example
pandas/core/frame.py
Outdated
|
||
>>> df.to_dict(into=OrderedDict) | ||
OrderedDict([('col2', OrderedDict([('a', 0.5), ('b', 0.75)])), | ||
('col1', OrderedDict([('a', 1), ('b', 2)]))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the output of this example correct? (I mean: is it what you actually get with the PR?)
As I think if you specify an OrderedDict, I would also expect to get the result in the correct order, which means col1, col2 (not col2, col1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed this up when writing the example - I switched the column order in-between writing these tests. This should be fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This look pretty close @dwkenefick. Just a few changes.
pandas/core/common.py
Outdated
@@ -479,6 +481,45 @@ def _dict_compat(d): | |||
for key, value in iteritems(d)) | |||
|
|||
|
|||
def prep_maping_for_to_dict(into): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even just standardize_mapping
pandas/core/common.py
Outdated
Parameters | ||
---------- | ||
into : instance or subclass of collections.Mapping | ||
The argument supplied to ``to_dict``. Must be a class, an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, though you can add a See Also
section to point to to_dict
. You can also remove references to to_dict
in the summary.
pandas/core/common.py
Outdated
the desired Mapping. | ||
|
||
""" | ||
if not inspect.isclass(into): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would remove this check. This function should just be to ensure that we have an instance that's satisfies the Mapping interface.
for row in self.values] | ||
elif orient.lower().startswith('i'): | ||
return dict((k, v.to_dict()) for k, v in self.iterrows()) | ||
return into_c((k, v.to_dict(into)) for k, v in self.iterrows()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct to use into
here? What if the user passed an instance rather than a class? Wouldn't the values all be written into the same object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct. v.to_dict(into)
should call standardize_mapping
again. Since standardize_mapping
only returns a class, I don't think there is a danger of populating the same object twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha.nI forgot that standardize_mapping
always returned a class
dict, | ||
collections.defaultdict(list), | ||
collections.OrderedDict]) | ||
def test_to_dict(self, mapping): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be tested elsewhere, but can you add a test with a dataframe that has duplicate columns? Make sure to catch the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - I added one at the end. Let me know if that is what you were getting at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor typos & another test, otherwise lgtm. ping on green.
pandas/core/common.py
Outdated
def standardize_mapping(into): | ||
""" | ||
Helper function to standardize a supplied mapping. | ||
.. versionadded:: 0.21.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs a blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/common.py
Outdated
---------- | ||
into : instance or subclass of collections.Mapping | ||
Must be a class, an initialized collections.defaultdict, | ||
or an empty instance of a collections.Mapping subclass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this last statement is true, it doesn't have to be empty (nor should we require it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed "empty," which should make this correct.
pandas/core/series.py
Outdated
The collections.Mapping subclass to use as the return | ||
object. Can be the actual class or an empty | ||
instance of the mapping type you want. If you want a | ||
collections.defaultdict, you must pass an initialized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must pass it initialized. (maybe elsewhere as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here and in frame.py
comp_data['duped'] = comp_data[df.columns[0]] | ||
for k, v in compat.iteritems(comp_data): | ||
for k2, v2 in compat.iteritems(v): | ||
assert (v2 == recons_data[k2][k]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add a test that hits some of the errors people might encounter (you do check these in the testing of standardize_mapping), but this is an integration test. you can put a test right after this, maybe test_to_dict_errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this test - made sure the TypeError
s were caught. Let me know if you think anything else should go in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few more comments on the docs
pandas/core/frame.py
Outdated
|
||
Examples | ||
-------- | ||
>>> from pandas import DataFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this import, but use pd.DataFrame
instead of DataFrame
in the other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/frame.py
Outdated
Examples | ||
-------- | ||
>>> from pandas import DataFrame | ||
>>> from collections import OrderedDict, defaultdict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this import to the example where it is used?
pandas/core/series.py
Outdated
""" | ||
Convert Series to {label -> value} dict | ||
Convert Series to {label -> value} dict or dict-like object | ||
Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line between the first line and Parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/series.py
Outdated
|
||
Examples | ||
-------- | ||
>>> from pandas import Series |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment here as for DataFrame (leave out the import, and use pd.Series
instead for consistency within the docstrings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/frame.py
Outdated
result : dict like {column -> {index -> value}} | ||
result : collections.Mapping like {column -> {index -> value}} | ||
If ``into`` is collections.defaultdict, the return | ||
value's default_factory will be None. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand this one. It seems to contrast with what is said above about a defaultdict needing to be initialized. So in that case, the default_factory will just be what is provided in the initialized defaultdict? (and which can be None, if you didn't provide a default_factory, but that seems a bit besides the point to mention here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from an earlier version, and I forgot to update the docs. This sentence is wrong, and its gone now.
@jreback look good to you? Your requested changes were around |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates!
Some minor extra comments
pandas/core/series.py
Outdated
return dict(compat.iteritems(self)) | ||
value_dict : collections.Mapping | ||
If ``into`` is collections.defaultdict, the return | ||
value's default_factory will be None. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed as well I think (you updated it for the DataFrame docstring)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pandas/core/frame.py
Outdated
{'a': {'col1': 1.0, 'col2': 0.5}, 'b': {'col1': 2.0, 'col2': 0.75}} | ||
|
||
You can also specify the mapping type. | ||
>>> from collections import OrderedDict, defaultdict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put a blank line between the two lines above?
(sorry for all these small comments, but sphinx / rst is quite nitpickly when it comes to whitespace, in order to render correctly in the html online documentation)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. These are easy.
lgtm. I think @jorisvandenbossche had a couple of small changes. |
The appveyor build finished: https://ci.appveyor.com/project/pandas-dev/pandas/build/1.0.1881 Not sure why it hasn't reported that it's done. Thanks @dwkenefick, nice work! |
* upstream/master: (48 commits) BUG: Categorical comparison with unordered (pandas-dev#16339) ENH: Adding 'protocol' parameter to 'to_pickle'. PERF: improve MultiIndex get_loc performance (pandas-dev#16346) TST: remove pandas-datareader xfail as 0.4.0 works (pandas-dev#16374) TST: followup to pandas-dev#16364, catch errstate warnings (pandas-dev#16373) DOC: new oauth token TST: Add test for clip-na (pandas-dev#16369) ENH: Draft metadata specification doc for Apache Parquet (pandas-dev#16315) MAINT: Add .iml to .gitignore (pandas-dev#16368) BUG/API: Categorical constructor scalar categories (pandas-dev#16340) ENH: Provide dict object for to_dict() pandas-dev#16122 (pandas-dev#16220) PERF: improved clip performance (pandas-dev#16364) DOC: try new token for docs DOC: try with new secure token DOC: add developer section to the docs DEPS: Drop Python 3.4 support (pandas-dev#16303) DOC: remove credential helper DOC: force fetch on build docs DOC: redo dev docs access token DOC: add dataframe construction in merge_asof example (pandas-dev#16348) ...
…6220) * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122
…6220) * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122 * ENH: Provide dict object for to_dict() pandas-dev#16122
>>> df | ||
col1 col2 | ||
a 1 0.1 | ||
b 2 0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 0.1 and 0.2 are wrong, should be 0.5 and 0.75
git diff upstream/master --name-only -- '*.py' | flake8 --diff